Bintree object (Multivariate Analysis Toolbox for MatlabŪ)

written by: Liran Carmel

Last modified: 14:11, Sun 12-Sep-2010

General Description
A binary tree is a tree, such that each node has exactly zero or two descendants. This objects inherits from the parent object tree.

Navigate to:     General Description     Class Structure     Class Construction     Class Functions

Class Structure
Each field can be accessed by the dot (.) operation, or by the GET function. The GET function can work on multiple instances simultaneously. Most fields, except for those that are Dependent, can be modified using the dot (.) operation, or by the SET function.
    Field Description Type Default Dedicated Get/Set Function  
    l_node left-descendant of each node double vector []    
    r_node right-descendant of each node double vector []    
    parent Inherited from tree. parent of each node double vector []    
    thd Inherited from digraph. target-height-differences matrix double matrix []    
    name Inherited from graph. name of object, should be short and used as identifier. This field will never be empty. string 'unnamed'    
    description Inherited from graph. verbal description of the class content. string ''    
    source Inherited from graph. verbal description of the source of information. string ''    
    type Inherited from graph. type of graph. string 'general graph'    
    node_name Inherited from graph. names of all nodes. cell array of strings {} nodenames  
    node_mass Inherited from graph. mass of each node. double vector []    
    node_cfield Inherited from graph. user-specific node customized fields. cell array of values {}    
    node_cfield_name Inherited from graph. names of node customized fields. cell array of strings {}    
    weights Inherited from graph. symmetric sparse weight matrix. double matrix []    
  Dependent no_nodes Inherited from graph. number of nodes in the graph. integer scalar 0 nonodes  
  Dependent no_node_cfields Inherited from graph. number of customized fields. integer scalar 0    
  Dependent no_edges Inherited from graph. number of edges in the graph. integer vector 0 noedges  

Class Construction
Empty instance (scalar)
an empty bintree instance, with all fields initialized to their default values.
syntax: btr = bintree;
Empty instance (matrix)
an array of empty bintree instances.
syntax: btr = bintree(size,'size');
Copy constructor
one bintree instance is copied into another.
syntax: btr_destination = bintree(btr_origin);
Construction by field names
an instance is formed by directly providing field values. Any field which is not dependent is permitted.
syntax: btr = bintree(field_name, field_value, ...);

List of Functions

Computations:

balance
computes the balance vector. Source: digraph.
dag2code
finds the DAG-code of a DAG. Source: digraph.
gtd
computes the graph theoretic distance between two nodes.
laplacian
computes the Laplacian of a graph. Source: graph.
vstruct
finds nodes that are center of a V-structure. Source: digraph.

Customized fields manipulations:

alloccfield
allocates a new customized field to a graph. Source: graph.
cfieldexist
finds whether a customized field exists in a graph. Source: graph.
cfieldnames
lists the customized fields in a GRAPH object. Source: graph.
getcfield
retrieves a customized field from a graph. Source: graph.
setcfield
sets values for a customized field of GRAPHs. Source: graph.

Display:

show
displays class content. Source: graph.

I/O functions:

dump
writes a DIGRAPH to disk. Source: digraph.

Information extraction:

ancestors
finds the sequence of ancestors of a specifed node. Source: tree.
descendants
finds all descandants of a specifed node. Source: tree.
iodegree
computes the in and out degrees of a digraph. Source: digraph.
iscomplete
tests whether the binary tree is fully connected.
iscyclic
finds whether a DIGRAPH is cyclic or not. Source: digraph.
lca
finds the last common ancestor of a list of nodes. Source: tree.
leaves
finds these nodes that are leaves. Source: tree.
leavesunder
lists the leaves that are descendants of a particular node. Source: tree.
nodeid
finds the IDs of a list of nodes. Source: graph.
parents
finds the parents of specific nodes. Source: digraph.
root
finds the root of the tree. Source: tree.

Maintenance:

verify
computes missing.

SET/GET functions:

get
get method
nodenames
retrieves the name of the nodes in the graph. Source: graph.
noedges
retrieves the number of edges in GRAPH objects. Source: graph.
nonodes
retrieves the number of nodes in GRAPH objects. Source: graph.
set
set method

Transformations:

addedge
adds an edge to a binary tree.
order
orders the nodes in a tree. Source: tree.
prunesubtree
prunes a subtree. Source: tree.
sampletree
samples the tree such as to keep a smaller number of leaves.
subtree
isolates the subtree branching from a certain node.
swap
replaces the indices of two nodes.
updatesubtree
substitutes the fields of a subtree in the father tree. Source: tree.

Visualization:

eigenproj
computes the eigenprojection of a graph. Source: graph.
view
plots a DIGRAPH Source: digraph.